package com.situ.mvc.service.impl;

import org.springframework.messaging.simp.user.UserDestinationMessageHandler;

import com.situ.mvc.common.ServerResponse;
import com.situ.mvc.dao.IUserDao;
import com.situ.mvc.dao.impl.UserDaoImpl;
import com.situ.mvc.entity.User;
import com.situ.mvc.service.IUserService;

public class UserServiceImpl implements IUserService {
	
	private IUserDao userDao = new UserDaoImpl();

	@Override
	public ServerResponse login(String name, String password) {
		if (userDao.checkName(name) == false) {
			return ServerResponse.createError("没有该用户名");
		}
		User user = userDao.login(name,password);
		if (user == null) {
			return ServerResponse.createError("密码错误");
		}
		return ServerResponse.createSuccess("登录成功", user);
	}

}
